package iot

type IOTS_TYPE int

const (
	MQTT IOTS_TYPE = iota
	REST
	TCPIP
	NATS
	AMQP
	CoAP
	XMPP
	DDS
)

type IoTClient interface {
	Publish(topic string, msg string)
	Subscribe(topic string, handleFun func([]byte)) error
}

func (t IOTS_TYPE) String() string {
	switch t {
	case 0:
		return "MQTT"
	case 1:
		return "REST"
	case 2:
		return "TCPIP"
	case 3:
		return "NATS"
	case 4:
		return "AMQP"
	case 5:
		return "CoAP"
	case 6:
		return "XMPP"
	case 7:
		return "DDS"
	default:
		return "未知"
	}
}
